Asynchronous Test ^^^^^ **Definition:** * A few tests take inordinately long to run; those tests contain explicit delays. **Code Example:** .. code-block:: java public class RequestHandlerThreadTest extends TestCase { private static final int TWO_SECONDS = 3000; public void testWasInitialized_Async() throws InterruptedException { RequestHandlerThread sut = new RequestHandlerThread(); sut.start(); Thread.sleep(TWO_SECONDS); assertTrue(sut.initializedSuccessfully()); } public void testHandleOneRequest_Async() throws InterruptedException { RequestHandlerThread sut = new RequestHandlerThread(); sut.start(); enqueueRequest(makeSimpleRequest()); Thread.sleep(TWO_SECONDS); assertEquals(1, sut.getNumberOfRequestsCompleted()); assertResponseEquals(makeSimpleResponse(), getResponse()); } } **References:** .. admonition:: Quality attributes * :octicon:`file-code;1em` - Code Example * :octicon:`comment-discussion;1em` - Cause and Effect * :octicon:`graph;1em` - Frequency * :octicon:`sync;1em` - Refactoring * `xUnit test patterns: Refactoring test code `_ :octicon:`file-code;1em` :octicon:`comment-discussion;1em` :octicon:`sync;1em`